package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.TbTest;
import com.ruoyi.system.service.ITbTestService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: zhoupeng
 * @date: 2021/9/16 22:36
 * @descreption: 部件和子项统计控制层
 */
@Controller
@RequestMapping("/system/deviceAndTestSubItemValue")
public class DeviceAndTestSubItemValue extends BaseController {

    private String prefix = "system/deviceAndTestSubItemValue";

    @Resource
    private ITbTestService tbTestService;

    @RequiresPermissions("system:deviceAndTestSubItemValue:view")
    @GetMapping()
    public String deviceAndTestSubItemValue(ModelMap mmap) {
        List<TbTest> tbTestList = tbTestService.selectTestItemNoList();
        mmap.put("tbTestList", tbTestList);
        mmap.put("tbTestFirst", tbTestList.get(0));
        return "system/deviceAndTestSubItemValue/deviceAndTestSubItemValue";
    }

    /**
     * 查询数据
     */
    @PostMapping("list")
    @ResponseBody
    public TableDataInfo list(TbTest tbTest) {
        List<TbTest> list = tbTestService.selectTbTestList(tbTest);
        return getDataTable(list);
    }
}
